<!DOCTYPE html>
<html lang="zh-CN" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="layout/default">
<head>
    <meta charset="UTF-8">
    <title>字典管理</title>
    <script type="text/javascript">
        
        $(document).ready(function() {
            $("#value").focus();

            var validateMessageBox = $('#validateMessageBox');
            $('#dictEditForm').validate({
                errorElement: 'label',
                errorClass: 'help-block',
                focusInvalid: true,
                errorContainer: validateMessageBox,
                errorPlacement: function (error, element) {

                    this.errorContainer.addClass('note-danger').html("<p>输入有误，请先更正。</p>").show();
                    var formGroup = $(element).closest('.form-group');
                    var errorElement = formGroup.children('span.'+this.errorClass);
                    if (!errorElement || errorElement.length == 0) {
                        errorElement = $('<span/>').addClass(this.errorClass);
                        errorElement.appendTo(formGroup);
                    }
                    error.appendTo(errorElement);

                },
                highlight: function (element) {
                    $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
                },

                unhighlight: function (element) {
                    $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
                },

                success: function (label, element) {
                    label.closest('.form-group').removeClass('has-error');
                },

                submitHandler: function (form) {
                    App.blockUI(window, true);
                    form.submit();
                }
            });
        });
    </script>
</head>
<body>
<div layout:fragment="content" th:remove="tag">

    <div class="row">
        <div class="col-md-12">
            <!-- BEGIN PAGE TITLE & BREADCRUMB-->
            <h3 class="page-title">
                字典管理
                <small>维护系统中的基础数据，该数据会在其他模块中用到。</small>
            </h3>
            <ul class="page-breadcrumb breadcrumb">
<!--                 <li class="btn-group"> -->
<!--                     <button type="button" class="btn blue dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" -->
<!--                             data-delay="1000" data-close-others="true"> -->
<!--                         <span>跳转</span> <i class="fa fa-angle-down"></i> -->
<!--                     </button> -->
<!--                     <ul class="dropdown-menu pull-right" role="menu"> -->
<!--                         <li><a th:href="@{/sys/dict}">字典列表</a></li> -->
<!--                         <li><a th:href="@{/sys/dict/form}">字典添加</a></li> -->
<!--                     </ul> -->
<!--                 </li> -->
                <li>
                    <i class="fa fa-home"></i>
                    <a th:href="@{/}">首页</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li>
                    <a href="#">系统设置</a>
                    <i class="fa fa-angle-right"></i>
                </li>
                <li><a href="#">字典管理</a></li>
            </ul>
            <!-- END PAGE TITLE & BREADCRUMB-->

        </div>
    </div>


    <div class="row">
        <div class="col-md-12">
            <!--BEGIN TABS-->
            <div class="tabbable tabbable-custom tabbable-full-width">
                <ul class="nav nav-tabs">
                    <li><a th:href="@{/sys/dict}">字典列表</a></li>
                    <li class="active">
                        <a href="#dict_tab_1_2">
                            字典添加
                        </a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="dict_tab_1_2">
                        <div class="portlet box blue">
                            <div class="portlet-title">
                                <div class="caption"><i class="fa fa-reorder"></i>
                                    <th:block th:text="${dict.id} == null ? '修改' : '添加'">查看</th:block>
                                    系统字典
                                </div>
                            </div>

                            <div class="portlet-body form">
                                <!-- BEGIN FORM-->
                                <form id="dictEditForm" class="form-horizontal" th:object="${dict}" th:action="@{/sys/dict/save}" method="post">
                                    <input type="hidden" th:field="*{id}"/>
                                    <div class="form-body">

                                        <div class="form-group">
                                            <label class="col-md-3 control-label">键值<span class="required">*</span></label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control required" th:field="*{value}" maxlength="50" title="键值"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">标签<span class="required">*</span></label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control required" th:field="*{label}" maxlength="100" title="标签"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">类型<span class="required">*</span></label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control required" th:field="*{type}" maxlength="100" title="类型"/>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">描述<span class="required">*</span></label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control required" th:field="*{description}" maxlength="100"  title="描述"/>
                                            </div>
                                        </div>
                                        <div class="form-group last">
                                            <label class="col-md-3 control-label">排序<span class="required">*</span></label>
                                            <div class="col-md-4">
                                                <input type="text" class="form-control required digits" th:field="*{sort}" maxlength="10"  title="排序"/>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="form-actions fluid">
                                        <div class="col-md-offset-3 col-md-4">
                                            <button id="submit_save" type="submit" class="btn blue">保 存</button>
                                            <button type="button" class="btn default" onclick="history.go(-1)">返 回</button>
                                        </div>
                                    </div>
                                </form>
                                <!-- END FORM-->
                            </div>

                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>


</div>


</body>
</html>
